﻿using System;
using System.Collections.Generic;
using System.Text;

namespace OOP
{
    public class InterfaceDemo3
    {
        //static void Main(string[] args)
        //{
        //    IPowerSupply powerSupply = new PowerSupply();
        //    DeskFan deskFan = new DeskFan(powerSupply);
        //    Console.WriteLine(deskFan.Work());
        //}
    }
    public interface IPowerSupply
    {
        int GetPower();
    }

    public class PowerSupply : IPowerSupply
    {
        public int GetPower()
        {
            return 220;
        }
    }

    public class DeskFan
    {
        private IPowerSupply powerSupply;
        public DeskFan(IPowerSupply powerSupply)
        {
            this.powerSupply = powerSupply;
        }

        public string Work()
        {
            if (powerSupply.GetPower() < 100)
            {
                return "Don't work";
            }
            else if (powerSupply.GetPower() > 250)
            {
                //return "Warming";
                return "Explode";
            }
            else
            {
                return "Working";
            }
        }
    }
}
